Skip to content

refactor: use renderable guard for menu item extras - #894

Merged
yoyo837 merged 1 commit into
react-component:masterfrom
QDyanbing:refactor-renderable-guards
Sep 3, 2026
Merged

refactor: use renderable guard for menu item extras#894
yoyo837 merged 1 commit into
react-component:masterfrom
QDyanbing:refactor-renderable-guards

Conversation

@QDyanbing

@QDyanbing QDyanbing commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

说明

  • 使用 isReactRenderable 统一判断菜单项 extra 是否需要渲染
  • 移除本地重复的 0 特殊判断,统一 ReactNode 展示语义
  • @rc-component/util 的最低版本提升到首次提供该 helper 的 ^1.13.0

验证

  • npm run tsc
  • npm run lint
  • npm test -- tests/Options.spec.tsx --runInBand

Summary by CodeRabbit

  • 问题修复
    • 优化菜单额外内容(extra)的渲染判断。
    • 对不可渲染的值(如布尔值、空字符串等)不再错误生成内容,提升菜单显示的准确性与稳定性。

@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

@QDyanbing is attempting to deploy a commit to the afc163's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: bc1e5925-5ca0-4f82-93a0-7ad2a2f3adb9

📥 Commits

Reviewing files that changed from the base of the PR and between d8d0629 and 05dbf61.

📒 Files selected for processing (2)
  • package.json
  • src/utils/nodeUtil.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

本次变更升级 @rc-component/util,并将菜单项 extra 的判断改为基于 React 可渲染性。

Changes

菜单项 extra 渲染

Layer / File(s) Summary
更新 extra 渲染判断
package.json, src/utils/nodeUtil.tsx
@rc-component/util^1.11.1 升级到 ^1.13.0convertItemsToNodes 使用 isReactRenderable(extra) 决定是否渲染 extra

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 05dbf

This localized change standardizes how menu item extras are rendered and updates the minimum utility dependency version; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: zombiej

Poem

小兔捧起新工具,
菜单枝头检 extra。
可渲染时轻轻现,
非节点值静静下。
依赖版本也更新,
代码清爽迎春芽。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要变更:菜单项 extra 内容改用可渲染值检查逻辑。标题简洁、明确,并与代码和 PR 目标一致。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.72%. Comparing base (d8d0629) to head (05dbf61).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #894   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          26       26           
  Lines         735      735           
  Branches      205      204    -1     
=======================================
  Hits          733      733           
  Misses          2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yoyo837 yoyo837 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the renderability semantics, helper selection, dependency floor, existing feedback, and completed CI results. The implementation looks correct. The Vercel failure is limited to team deployment authorization and is not a code or build failure.

@yoyo837
yoyo837 merged commit a963efe into react-component:master Sep 3, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants